<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="../css/docs.css" type="text/css" rel="stylesheet" />
<link href="../css/prettify.css" type="text/css" rel="stylesheet" />
<script src="../js/prettify.js" type="text/javascript"></script>
</head>
<body onLoad="prettyPrint()">
<div class="g-unit" id="doc-content">
<div id="api-info-block">
    <div class="api-level">H3C CAS云管理平台</div>
  </div>
  <div id="jd-header">
    <h1>虚拟机批量部署</h1>
  </div>
</div>
<div id="jd-content">
<div class="jd-descr">
<p>批量部署虚拟机</p>
<h2><a name="uri"></a>接口 URI</h2>
<p>/cas/casrs/vm/batchDeploy</p>
<h2><a name="access"></a>访问方法</h2>
<dl>
  <dt><b>HTTP 方法</b></dt>
  <dd>POST</dd>
  <dt><b>消息体</b></dt>
  <div class="source">
    <pre class="prettyprint lang-xml">
 &lt;list&gt;
  &lt;domainConfig&gt;  
    &lt;id&gt;2&lt;/id&gt; 
    &lt;domainName&gt;wfg-rs-deploy-01&lt;/domainName&gt;
    &lt;title&gt;wfg-rs-deploy-01&lt;/title&gt;
    &lt;desc&gt;desc&lt;/desc&gt; 
    &lt;targetHostId&gt;1&lt;/targetHostId&gt; 
    &lt;deployMode&gt;1&lt;/deployMode&gt;  
    &lt;storage&gt;
        &lt;src&gt;wfg-t&lt;/src&gt; 
        &lt;dest&gt;wfg-rs-store&lt;/dest&gt;  
        &lt;pool&gt;defaultpool&lt;/pool&gt;  
    &lt;/storage&gt; 
    &lt;network&gt;
        &lt;mac&gt;0c:da:41:1d:05:cf&lt;/mac&gt;
        &lt;vSwitchName&gt;vswitch0&lt;/vSwitchName&gt;
        &lt;ip&gt;192.168.20.22&lt;/ip&gt;
        &lt;profileName&gt;Default&lt;/profileName&gt;
    &lt;/network&gt;  
  &lt;/domainConfig&gt;  
  &lt;domainConfig&gt;  
    &lt;id&gt;2&lt;/id&gt;  
    &lt;domainName&gt;wfg-rs-deploy-02&lt;/domainName&gt;  
    &lt;desc&gt;desc&lt;/desc&gt;  
    &lt;targetHostId&gt;1&lt;/targetHostId&gt; 
    &lt;deployMode&gt;1&lt;/deployMode&gt;  
    &lt;storage&gt;  
        &lt;src&gt;wfg-t&lt;/src&gt;  
        &lt;dest&gt;wfg-rs-store-02&lt;/dest&gt; 
        &lt;pool&gt;defaultpool&lt;/pool&gt;  
    &lt;/storage&gt;  
    &lt;osInfo&gt;
	&lt;sysIp&gt;3.3.3.3&lt;/sysIp&gt;
	&lt;sysMask&gt;255.255.255..0&lt;/sysMask&gt; 
	&lt;sysGateway&gt;3.3.2.56&lt;/sysGateway&gt;
	&lt;sysdns&gt;25.26.27.28&lt;/sysdns&gt;
	&lt;secondaryDns&gt;14.15.16.17&lt;/secondaryDns&gt;		
	&lt;isBindIp&gt;true&lt;/isBindIp&gt;   	
    &lt;/osInfo&gt; 
  &lt;/domainConfig&gt;  
&lt;/list&gt;</pre>
  </div>
</dl>

<dt><a name="detail"></a><b>元素含义</b></dt>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">domainConfig</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">id</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad"></span>模板ID
            <div class="jd-descrdiv">长整数（long）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">domainName</span></td>
        <td class="jd-linkcol">部署虚拟机名字。
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      
      <tr class="jd-typecol">
        <td class="jd-typecol"><span class="prettyprint lang-xml">title</span></td>
        <td class="jd-linkcol">部署虚拟机显示名字。
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      
      <tr>
        <td class="alt-color"><div align="right"><span class="prettyprint lang-xml">desc</span></div></td>
        <td class="jd-linkcol"><span class="sympad">虚拟机描述信息</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
    <tr class="jd-typecol">
        <td class="jd-typecol"><span class="prettyprint lang-xml">targetHostId</span></td>
        <td class="jd-linkcol"><span class="sympad">目标主机ID</span>
          <div class="jd-descrdiv">长整型（long）类型。</div></td>
      </tr>
    <tr>
        <td class="alt-color"><span class="prettyprint lang-xml">deployModel</span></td>
        <td class="jd-linkcol"><span class="sympad">部署虚拟机方式（0表述正常部署，1表示快速部署）。</span>
          <div class="jd-descrdiv">整数（int）类型。</div></td>
    </tr>
    <tr class="jd-typecol">
        <td class="jd-typecol"><span class="prettyprint lang-xml">storage</span></td>
        <td class="jd-linkcol">虚拟机存储列表。
          <div class="jd-descrdiv">
            <DIV>集合（List）类型。</DIV>
          </div></td></tr>
    <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">network</span></td>
        <td class="jd-linkcol">虚拟机网卡信息列表。
          <div class="jd-descrdiv">
            <DIV>集合（List）类型。</DIV>
          </div></td></tr>      
          <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">osInfo</span></td>
        <td class="jd-linkcol">设置系统IP信息。</td></tr> 
  </table>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">storage</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">src</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">原存储镜像文件名。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">dest</span></td>
        <td class="jd-linkcol"><span class="sympad">目的存储镜像文件名。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">pool</span></td>
        <td class="jd-linkcol"><span class="sympad">目的存储池。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>   
  </table>
  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">network</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">mac</span></div></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">网卡MAC地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">vSwitchName</span></div></td>
        <td class="jd-linkcol"><span class="sympad">网络交换机名称。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><div align="right">ip</div></td>
        <td class="jd-linkcol"><span class="sympad">网卡绑定的IP地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
	  <tr class="alt-color">
        <td class="jd-typecol"><div align="right"><span class="prettyprint lang-xml">profileName</span></div></td>
        <td class="jd-linkcol"><span class="sympad">网络策略模板名称。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
  </table>

  <table id="pubmethods" class="jd-sumtable">
    <tbody>
      <tr>
        <th colspan="2"><span class="prettyprint lang-xml">osInfo</span>各子元素</th>
      </tr>
      <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">sysIp</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">IP地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">sysMask</span></td>
        <td class="jd-linkcol"><span class="sympad">子网掩码地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">sysGateway</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">默认网关地址。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">sysdns</span></td>
        <td class="jd-linkcol"><span class="sympad">首选DNS服务器。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr>
        <td class="jd-typecol"><span class="prettyprint lang-xml">secondaryDns</span></td>
        <td width="100%" class="jd-linkcol"><span class="sympad">备用DNS服务器。</span>
          <div class="jd-descrdiv">字符串（String）类型。</div></td>
      </tr>
      <tr class="alt-color">
        <td class="jd-typecol"><span class="prettyprint lang-xml">isBindIp</span></td>
        <td class="jd-linkcol"><span class="sympad">是否绑定IP。</span>
          <div class="jd-descrdiv">布尔型。</div></td>
      </tr>
      
  </table>
  
<h2><a name="result"></a>返回结果</h2>
<dl>
  <dt><b>状态码</b></dt>
  <dd>
  <ul>
    <li>HTTP/1.1 200 OK：成功。</li>
  </ul>
  </dd>
</dl>

    <h2><a name="example"></a>应用举例</h2>
    <p>批量部署两个虚拟机</p>
    <dl>
      <dt><b>请求</b></dt>
      <div class="source">
        <pre class="prettyprint lang-xml">POST http://192.168.0.4:8080/cas/casrs/vm/batchDeploy
         accept: application/xml

  <br>
 &lt;list&gt;
  &lt;domainConfig&gt;  
    &lt;id&gt;2&lt;/id&gt; 
    &lt;domainName&gt;wfg-rs-deploy-01&lt;/domainName&gt;
    &lt;title&gt;wfg-rs-deploy-01&lt;/title&gt;
    &lt;desc&gt;desc&lt;/desc&gt; 
    &lt;targetHostId&gt;1&lt;/targetHostId&gt; 
    &lt;deployMode&gt;1&lt;/deployMode&gt;  
    &lt;storage&gt;
        &lt;src&gt;wfg-t&lt;/src&gt; 
        &lt;dest&gt;wfg-rs-store&lt;/dest&gt;  
        &lt;pool&gt;defaultpool&lt;/pool&gt;  
    &lt;/storage&gt; 
    &lt;network&gt;
        &lt;mac&gt;0c:da:41:1d:05:ce&lt;/mac&gt;
        &lt;vSwitchName&gt;vswitch0&lt;/vSwitchName&gt;
        &lt;ip&gt;192.168.20.21&lt;/ip&gt;
        &lt;profileName&gt;Default&lt;/profileName&gt;
    &lt;/network&gt;  
  &lt;/domainConfig&gt;  
  &lt;domainConfig&gt;  
    &lt;id&gt;2&lt;/id&gt;  
    &lt;domainName&gt;wfg-rs-deploy-02&lt;/domainName&gt;  
    &lt;desc&gt;desc&lt;/desc&gt;  
    &lt;targetHostId&gt;1&lt;/targetHostId&gt; 
    &lt;deployMode&gt;1&lt;/deployMode&gt;  
    &lt;storage&gt;  
        &lt;src&gt;wfg-t&lt;/src&gt;  
        &lt;dest&gt;wfg-rs-store-02&lt;/dest&gt; 
        &lt;pool&gt;defaultpool&lt;/pool&gt;  
    &lt;/storage&gt;  
    &lt;network&gt;
        &lt;mac&gt;0c:da:41:1d:05:cf&lt;/mac&gt;
        &lt;vSwitchName&gt;vswitch0&lt;/vSwitchName&gt;
        &lt;ip&gt;192.168.20.22&lt;/ip&gt;
        &lt;profileName&gt;Default&lt;/profileName&gt;
    &lt;/network&gt; 
  &lt;/domainConfig&gt;  
&lt;/list&gt;</pre>
      </div>
      <dt><b>回应</b></dt>
       <pre class="prettyprint lang-xml">HTTP/1.1 200 OK<br>Expires: Thu, 01 Jan 1970 00:00:00 GMT<br>Set-Cookie: JSESSIONID=1aw0joul8i38n;Path=/<br>Content-Type: application/xml<br>Content-Length: 444<br>Server: Jetty(6.1.x)

&lt;/rsKeyValues&gt;

&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;
&lt;rsTaskMsgs&gt;
	&lt;taskMsg&gt;
		&lt;msgId&gt;1417833708602&lt;/msgId&gt;
		&lt;targetName&gt;虚拟机01&lt;/targetName&gt;
		&lt;completed&gt;false&lt;/completed&gt;
		&lt;progress&gt;0&lt;/progress&gt;
		&lt;eventType&gt;0&lt;/eventType&gt;
	&lt;/taskMsg&gt;
	&lt;taskMsg&gt;
		&lt;msgId&gt;1417833708603&lt;/msgId&gt;
		&lt;targetName&gt;虚拟机02&lt;/targetName&gt;
		&lt;completed&gt;false&lt;/completed&gt;
		&lt;progress&gt;0&lt;/progress&gt;
		&lt;eventType&gt;0&lt;/eventType&gt;
	&lt;/taskMsg&gt;
&lt;/rsTaskMsgs&gt;
</pre>
    </dl>
    
</div>
</div>
</body>
</html>